<!--
 * @Author: your name
 * @Date: 2022-02-28 15:39:50
 * @LastEditTime: 2022-02-28 15:56:31
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue\vue-douban-pc\src\views\sendingComment.vue
-->
<template>
    <div class="sendingcomment">
        <el-col :span="4">
            <h1></h1>
        </el-col>
        <el-col :span="20">
            <el-table :data="comment" style="width: 100%;" max-height="658">
                <el-table-column label="序列" type="index"></el-table-column>
                <el-table-column label prop></el-table-column>
                <el-table-column label="发送的评论" prop="comment"></el-table-column>
                <el-table-column align="right">
                    <template slot-scope="scope">
                        <el-button size="mini" type="danger" @click="clearComment(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-col>
    </div>
</template>

<script>
import { getUserInfo } from "../utils/auth";
export default {
    name: 'VueSendingcomment',

    data() {
        return {
            userId: "",
            comment: [],
        };
    },
    created() {
        this.userId = getUserInfo().users.user_id
        this.getComment();
    },
    mounted() {
        
    },

    methods: {
        getComment() {
            this.axios.get("/getOwnComment", {
                params: {
                    id: this.userId
                }
            }).then((res) => {
                this.comment = res.data;
                console.log(res.data);
            })
        },
        clearComment(row) {
            this.axios.get("/deleteOwnComment", {
                params: {
                    id: row.comm_id
                }
            })
            this.$router.go(0)
        }
    },
};
</script>

<style lang="scss" scoped>
.sendingcomment {
    position: relative;
    z-index: 10;
}
</style>